package com.ruoyi.stomp.controller;

import org.springframework.messaging.handler.annotation.MessageExceptionHandler;
import org.springframework.messaging.simp.annotation.SendToUser;
import org.springframework.stereotype.Controller;

/**
 * @ClassName GlobalMessageExceptionHandler
 * @Description STOMP 异常处理（把错误推到 /user/queue/errors）
 * @Author li yang
 * @Date 2025/9/8 09:59
 * @Version 1.0
 */
@Controller
public class GlobalMessageExceptionHandler {

    @MessageExceptionHandler
    @SendToUser("/queue/errors")
    public String handle(Exception e) {
        return "ERROR: " + e.getMessage();
    }
}
